package com.mms.action.department;

import java.util.List;

import com.mms.dao.DepartmentManagementDao;
import com.mms.entity.Department;
import com.opensymphony.xwork2.Action;

public class DeleteDapartmentAction implements Action{

	private int startPage;
	private List<Department> departmentMes;
	private int account;
	private int delDeID;
	private boolean DelisSuccess;
	
	
	public boolean isDelisSuccess() {
		return DelisSuccess;
	}


	public void setDelisSuccess(boolean delisSuccess) {
		DelisSuccess = delisSuccess;
	}


	public int getStartPage() {
		return startPage;
	}


	public void setStartPage(int startPage) {
		this.startPage = startPage;
	}


	public List<Department> getDepartmentMes() {
		return departmentMes;
	}


	public void setDepartmentMes(List<Department> departmentMes) {
		this.departmentMes = departmentMes;
	}


	public int getAccount() {
		return account;
	}


	public void setAccount(int account) {
		this.account = account;
	}


	public int getDelDeID() {
		return delDeID;
	}


	public void setDelDeID(int delDeID) {
		this.delDeID = delDeID;
	}


	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		DepartmentManagementDao dmd = new DepartmentManagementDao();
		Department department = new Department();
		department.setDeId(delDeID);
		if(dmd.DeleteDepartment(department)){
			DelisSuccess = true;
		}else{
			DelisSuccess = false;
		}
		departmentMes = dmd.getDepCount(startPage);
		account = dmd.getcount();
		return "success";
	}

}
